package mhcs.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.PopupPanel;

class MinConfigButton extends Button {
    
    public MinConfigButton() {
        super("Configs");
        final MinConfigPopup popup = new MinConfigPopup();
        addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
                  public void setPosition(int offsetWidth, int offsetHeight) {
                    int left = (Window.getClientWidth() - offsetWidth) / 3;
                    int top = (Window.getClientHeight() - offsetHeight) / 3;
                    popup.setPopupPosition(left, top);
                  }
                });
              }
            });
    }
}